<!DOCTYPE html>
<html>
<head>
    <title>记录信息</title>
    #parse("sys/header.html")
</head>
<body>
<div id="rrapp" v-cloak>
    <!--<i-form ref="formValidate" :label-width="80" style="text-align: center">
        <Row>
            <i-col span="6">
                <Form-item label="工序号">
                    <span>
                        {{devMaintenWork.devProceNo}}
                    </span>
                </Form-item>
            </i-col>
            <i-col span="6">
                <Form-item label="报修编号">
                    <span>
                        {{repair_code}}
                    </span>
                </Form-item>
            </i-col>
            <i-col span="6">
                <Form-item label="设备编码">
                    <span>
                        {{devCode}}
                    </span>
                </Form-item>
            </i-col>
            <i-col span="6">
                <Form-item label="设备名称">
                    <span>
                        {{devMaintenWork.devName}}
                    </span>
                </Form-item>
            </i-col>
        </Row>
        <Row>
            <i-col span="6">
                <Form-item label="所处车间">
                    <span>
                        {{devMaintenWork.workshopName}}
                    </span>
                </Form-item>
            </i-col>
            <i-col span="6">
                <Form-item label="报修时间">
                    <span>
                        {{transDate(devMaintenWork.uploadDate,"yyyy-MM-dd hh:mm:ss")}}
                    </span>
                </Form-item>
            </i-col>
            <i-col span="6">
                <Form-item label="故障代码">
                    <span>
                        {{devMaintenWork.faultCode}}
                    </span>
                </Form-item>
            </i-col>
            <i-col span="6">
                <Form-item label="报修状态">
                    <span>
                        {{sysEnums.RECHECK_STATUS[devMaintenWork.devStatus]}}
                    </span>
                </Form-item>
            </i-col>
        </Row>
        <Row>
            <i-col span="24">
                <Form-item label="故障描述">
                    <span>{{devMaintenWork.faultCon}}</span>
                </Form-item>
            </i-col>
        </Row>
    </i-form>-->
    <Card>
        <Tabs value="record0" type="card">
            <Tab-pane label="维修记录" name="record0">
                <table id="repar_record"></table>
            </Tab-pane>
            <Tab-pane label="换件记录" name="record1">
                <table id="change_record"></table>
            </Tab-pane>
            <Tab-pane label="8D记录" name="record2">
                <table id="8D_record"></table>
            </Tab-pane>
        </Tabs>
    </Card>
</div>

<script>
    var repair_code = getQueryString("repair_code");
    var repair_id = getQueryString("repair_id");
    var devCode = getQueryString("devCode");
    var devId = getQueryString("devId");

    let vm ;

    $(function () {

        vm = new Vue({
            el: '#rrapp',
            data: {
                devMaintenWork: {
                    isSure: '',
                    approvalId: '',
                    devStatus: '',
                    uploadDate: '',
                    faultCon: '',
                    faultType: '',
                    faultCode: '',
                    uploadName: '',
                    uploadId: '',
                    devId: '',
                    devName: '',
                    devCode: '',
                    devProceNo: '',
                    repairCode: '',
                    workshopId: '',
                    workshopName: '',
                    id: '',
                    existent: '1',
                    delFlag: '',
                    repairUser: '',
                    approvalDate: '',
                    imgUrl: ''
                }
            }
        });

        loadRecord(repair_id);
        $("#repar_record").Grid({
            url: '../devmaintenrepair/list?devId=' + devId,
            autowidth: true,
            colModel: [
                {label: '设备名称', name: 'devName', index: 'DEV_NAME', width: 80},
                // {label: '故障类型', name: 'type', index: 'TYPE', width: 80},
                {label: '故障代码', name: 'faultCode', index: 'FAULT_CODE', width: 80},
                // {label: '纳入知识库', name: 'repairInKnow', index: 'REPAIR_IN_KNOW', width: 80},
                // {label: '故障时长（分钟）', name: 'faultNum', index: 'faultNum', width: 80},
                {
                    label: '确认时间', name: 'sureDate', index: 'SURE_DATE', width: 80,
                    formatter: function (value) {
                        return transDate(value,"yyyy-MM-dd hh:mm:ss");
                    }
                },
                {label: '维修人', name: 'repairUser', index: 'REPAIR_USER', width: 80},
                {label: '报修确认人', name: 'sureUser', index: 'SURE_USER', width: 80},
                {
                    label: '维修结束时间', name: 'repairEndDate', index: 'REPAIR_END_DATE', width: 140,
                    formatter: function (value) {
                        return transDate(value,"yyyy-MM-dd hh:mm:ss");
                    }
                },
                {
                    label: '维修开始时间', name: 'repairStartDate', index: 'REPAIR_START_DATE', width: 140,
                    formatter: function (value) {
                        return transDate(value,"yyyy-MM-dd hh:mm:ss");
                    }
                },
                ]
        });
        /**
         * 备件更换历史记录
         */
        $("#change_record").Grid({
            url: '../sparepartout/list?useDevCode='+devCode,
            colModel: [
                {label: '出库仓库', name: 'outStore', index: 'OUT_STORE', width: 80},
                {label: '出库单号', name: 'outCode', index: 'OUT_CODE', width: 80},
                {label: '名称', name: 'name', index: 'NAME', width: 80},
                {label: '规格', name: 'spec', index: 'SPEC', width: 80},
                {label: '单位', name: 'partUnit', index: 'PART_UNIT', width: 80},
                {label: '出库数量', name: 'outNum', index: 'OUT_NUM', width: 50},
                {label: '退库数量', name: 'backNum', index: 'BACK_NUM', width: 50},
                {label: '实际出库量', name: 'relNum', index: 'REL_NUM', width: 60},
                {label: '领用单位', name: 'useUnit', index: 'USE_UNIT', width: 80},
                {label: '领用人员', name: 'createUserName', index: 'createUserName', width: 80},
                {label: '维修单号', name: 'repairNo', index: 'REPAIR_NO', width: 80},
                {label: '领料单号', name: 'pickNo', index: 'PICK_NO', width: 80},
                {label: '使用设备码', name: 'useDevCode', index: 'USE_DEV_CODE', width: 80},
                {label: '使用设备', name: 'useDevName', index: 'USE_DEV_NAME', width: 80},
                {
                    label: '出库日期', name: 'outDate', index: 'OUT_DATE', width: 140, formatter: function (value) {
                        return transDate(value, 'yyyy-MM-dd hh:mm:ss');
                    }
                },
                {label: 'id', name: 'id', index: 'ID', key: true, hidden: true},
            ]
        });
        $("#8D_record").Grid({
            url: '../follow8drecord/list?devCode=' + devCode,
            colModel: [
                {label: 'id', name: 'id', index: 'ID', key: true, hidden: true},
                {label: '设备编码', name: 'devCode', index: 'DEV_CODE', width: 80},
                {label: '设备名称', name: 'devName', index: 'DEV_NAME', width: 80},
                {label: '责任人', name: 'personLia', index: 'PERSON_LIA', width: 80},
                {label: '预防措施', name: 'precaution', index: 'PRECAUTION', width: 80},
                {
                    label: '故障发生时间', name: 'happenDate', index: 'HAPPEN_DATE', width: 140, formatter: function (value) {
                        return transDate(value, 'yyyy-MM-dd')
                    }
                },
                {label: '工位名称', name: 'workName', index: 'WORK_NAME', width: 80},
                {label: '生产线ID', name: 'proLineId', index: 'PRO_LINE_ID', width: 80},
                {label: '车间', name: 'workshopName', index: 'WORKSHOP_NAME', width: 80},
                {label: '创建人员', name: 'createName', index: 'CREATE_USER', width: 80},
                {
                    label: '创建时间', name: 'createDate', index: 'CREATE_DATE', width: 140, formatter: function (value) {
                        return transDate(value, 'yyyy-MM-dd')
                    }
                },
                {label: '审核人', name: 'reviewerName', index: 'REVIEWER', width: 80},
                {
                    label: '审核状态',
                    name: 'reviewStatus',
                    index: 'REVIEW_STATUS',
                    width: 80,
                    formatter: function (value) {
                        return sysEnums.CHECK_FLAG[value]
                    }
                },
                {
                    label: '审核时间', name: 'reviewTime', index: 'REVIEW_TIME', width: 140, formatter: function (value) {
                        return transDate(value, 'yyyy-MM-dd')
                    }
                },
                {label: '复审人', name: 'recheckUserName', index: 'RECHECK_USER', width: 80},
                {
                    label: '复审状态',
                    name: 'recheckStatus',
                    index: 'RECHECK_STATUS',
                    width: 80,
                    formatter: function (value) {
                        return sysEnums.RECHECK_STATUS[value]
                    }
                },
                {
                    label: '复审时间', name: 'recheckTime', index: 'RECHECK_TIME', width: 140, formatter: function (value) {
                        return transDate(value, 'yyyy-MM-dd')
                    }
                },
                {label: '8D附件', name: 'file8d', index: 'FILE_8D', width: 80}
            ]
        });
    });



    function loadRecord(repair_id){
        Ajax.request({
            url: "../devmaintenwork/info/" + repair_id,
            async: false,
            successCallback: function (r) {
                vm.devMaintenWork = r.devMaintenWork;
            }
        });
    }
</script>
</body>
</html>
